﻿Public Class PMTTableActuarielle
    Implements IPMTTablesActuarielles

#Region "Variables privées"
    Private _TableDeroules As IFichierPMT
    Private _TableReassurance As IFichierPMT
    Private _TableTxComEtFrais As IFichierPMT
#End Region

#Region "Constructeurs"
    Public Sub New()
        _TableDeroules = New FichierPMT_NonRenseigne
        _TableReassurance = New FichierPMT_NonRenseigne
        _TableTxComEtFrais = New FichierPMT_NonRenseigne
    End Sub
#End Region

#Region "Propriétés"
    Public Property Deroule As IFichierPMT Implements IPMTTablesActuarielles.Deroule
        Get
            Return _TableDeroules
        End Get
        Friend Set(value As IFichierPMT)
            _TableTxComEtFrais = value
            RaiseEvent Changed(Me, New EventArgs)
        End Set
    End Property
    Public Property Reassurance As IFichierPMT Implements IPMTTablesActuarielles.Reassurance
        Get
            Return _TableReassurance
        End Get
        Friend Set(value As IFichierPMT)
            _TableReassurance = value
            RaiseEvent Changed(Me, New EventArgs)
        End Set
    End Property
    Public Property TxComEtFrais As IFichierPMT Implements IPMTTablesActuarielles.TxComEtFrais
        Get
            Return _TableTxComEtFrais
        End Get
        Friend Set(value As IFichierPMT)
            _TableTxComEtFrais = value
            RaiseEvent Changed(Me, New EventArgs)
        End Set
    End Property
#End Region

#Region "Evenements"
    Public Event Changed(sender As Object, e As EventArgs) Implements IPMTTablesActuarielles.Changed
#End Region

    Public Function GetSchema() As Xml.Schema.XmlSchema Implements Xml.Serialization.IXmlSerializable.GetSchema
        Return Nothing
    End Function

    Public Sub ReadXml(reader As Xml.XmlReader) Implements Xml.Serialization.IXmlSerializable.ReadXml
        Dim XmlTblesActu As XElement = XElement.Load(reader)
        _TableDeroules = FichierPMT_Builer.ReadXml(XmlTblesActu.<PMTTableActuarielle>.<Deroule>.FirstOrDefault.CreateReader)
        _TableTxComEtFrais = FichierPMT_Builer.ReadXml(XmlTblesActu.<PMTTableActuarielle>.<TxComEtFrais>.FirstOrDefault.CreateReader)
        _TableReassurance = FichierPMT_Builer.ReadXml(XmlTblesActu.<PMTTableActuarielle>.<Reassurance>.FirstOrDefault.CreateReader)
    End Sub

    Public Sub WriteXml(writer As Xml.XmlWriter) Implements Xml.Serialization.IXmlSerializable.WriteXml
        writer.WriteStartElement("PMTTableActuarielle")

        writer.WriteStartElement("Deroule")
        Deroule.WriteXml(writer)
        writer.WriteEndElement()

        writer.WriteStartElement("Reassurance")
        Reassurance.WriteXml(writer)
        writer.WriteEndElement()

        writer.WriteStartElement("TxComEtFrais")
        TxComEtFrais.WriteXml(writer)
        writer.WriteEndElement()

        writer.WriteEndElement()
    End Sub
End Class
